home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / source / jade-3.2.lha / jade-3.2 / man / jade.info-8 < prev    next >
Encoding:
GNU Info File  |  1994-10-16  |  49.1 KB  |  1,357 lines

  1. This is Info file jade.info, produced by Makeinfo-1.55 from the input
  2. file jade.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Jade: (jade).            An editor for X11 and AmigaDOS
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This is Edition 1.3, last updated 7 October 1994, of `The Jade
  9. Manual', for Jade, Version 3.2.
  10.  
  11.    Jade is a text editor for X11 (on Unix) and the Amiga.
  12.  
  13.    Copyright 1993, 1994 John Harper.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of this
  16. manual provided the copyright notice and this permission notice are
  17. preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided that
  21. the entire resulting derived work is distributed under the terms of a
  22. permission notice identical to this one.
  23.  
  24. 
  25. File: jade.info,  Node: Keymaps,  Next: Event Loop,  Prev: Input Events,  Up: Programming Jade
  26.  
  27. Keymaps
  28. =======
  29.  
  30.    A "keymap" is a Lisp object defining a mapping between input events
  31. (*note Input Events::.) and commands to be executed when the event loop
  32. (*note Event Loop::.) receives the input event.
  33.  
  34.  - Function: keymapp OBJECT
  35.      Returns `t' when OBJECT is a keymap.
  36.  
  37. * Menu:
  38.  
  39. * Types of Keymap::             Two different formats of keymap
  40. * Creating Keymaps::            Allocating new keymaps
  41. * Binding Keys::                Inserting and removing key bindings
  42. * Key Lookup::                  How a key press is resolved into a command
  43. * Prefix Keys::                 Chaining events into multiple-event
  44.                                   bindings
  45. * Standard Keymaps::            Predefined keymaps you can modify
  46.  
  47. 
  48. File: jade.info,  Node: Types of Keymap,  Next: Creating Keymaps,  Up: Keymaps
  49.  
  50. Types of Keymap
  51. ---------------
  52.  
  53.    There are two different types of keymap; one for keymaps which
  54. contain only a few bindings, the other providing a more efficient
  55. method of storing larger numbers of bindings.
  56.  
  57. "Key lists"
  58.      These are used for keymaps which only contain a few bindings; they
  59.      are lists whose first element is the symbol `keymap'. All
  60.      subsequent elements define bindings, they are represented by
  61.      three-element vectors. The first two are the contents of the cons
  62.      cell representing the input event, the other element is the
  63.      command to be invoked.
  64.  
  65.      For example,
  66.  
  67.           (keymap [120 9 some-command])
  68.  
  69.      Since the event `(120 . 9)' is the key press `Ctrl-x', this keymap
  70.      binds the command `some-command' to the key press `Ctrl-x'.
  71.  
  72. "Key tables"
  73.      Key tables are used for keymaps which contain a larger number of
  74.      bindings.  They are vectors of 127 elements, a hash function is
  75.      used to hash each event contained in the keymap into one of the
  76.      127 buckets. Each bucket is a list of key bindings in the same
  77.      form as a key list (but without the `keymap' symbol).
  78.  
  79. 
  80. File: jade.info,  Node: Creating Keymaps,  Next: Binding Keys,  Prev: Types of Keymap,  Up: Keymaps
  81.  
  82. Creating Keymaps
  83. ----------------
  84.  
  85.    Since there are two different types of keymap (lists and tables)
  86. there are two different functions for creating them with.
  87.  
  88.  - Function: make-keylist
  89.      Creates and returns a new key list containing no bindings.
  90.  
  91.           (make-keylist)
  92.               => (keymap)
  93.  
  94.  - Function: make-keytab
  95.      This function returns a new key table; it will be totally empty.
  96.  
  97.           (make-keytab)
  98.               => [nil nil ... nil]
  99.  
  100.    If you want to produce a new copy of a keymap use the `copy-sequence'
  101. function (*note Sequence Functions::.) to duplicate the source keymap.
  102.  
  103. 
  104. File: jade.info,  Node: Binding Keys,  Next: Key Lookup,  Prev: Creating Keymaps,  Up: Keymaps
  105.  
  106. Binding Keys
  107. ------------
  108.  
  109.    The `bind-keys' function is used to install new key bindings into a
  110. keymap (either a key list or table).
  111.  
  112.  - Function: bind-keys KEYMAP &rest BINDINGS
  113.      This function installs zero or more key bindings into the keymap
  114.      KEYMAP.
  115.  
  116.      Each binding is defined by two elements in the list of BINDINGS,
  117.      the first defines the name of the input event (or the event itself)
  118.      and the second defines the command to be associated with the event.
  119.  
  120.      For example to bind two keys in the keymap KEYMAP; the event
  121.      `Ctrl-f' to the command `goto-next-char' and the event `Ctrl-b' to
  122.      the command `goto-prev-command' the following form would be used,
  123.  
  124.           (bind-keys KEYMAP
  125.            "Ctrl-f" 'goto-next-char
  126.            "Ctrl-b" 'goto-prev-char)
  127.  
  128.  - Function: unbind-keys KEYMAP &rest KEYS
  129.      This function removes the bindings of the events KEYS (these may
  130.      be the names of the events or the event objects themselves) from
  131.      the keymap KEYMAP.
  132.  
  133.           (unbind-keys KEYMAP
  134.            "Ctrl-f"
  135.            "Ctrl-b")
  136.  
  137. 
  138. File: jade.info,  Node: Key Lookup,  Next: Prefix Keys,  Prev: Binding Keys,  Up: Keymaps
  139.  
  140. Key Lookup
  141. ----------
  142.  
  143.    Each time the event loop (*note Event Loop::.) receives an input
  144. event from the window system it searches for a binding of that event.
  145.  
  146.    The variables `keymap-path' and `next-keymap-path' are used to
  147. determine the "keymap environment", this is the list of keymaps which
  148. are searched when looking for the binding.
  149.  
  150.  - Function: lookup-event-binding EVENT &optional RESET-PATH
  151.      This function examines the current keymap environment for a
  152.      binding of the event EVENT (*note Input Events::.). If such a
  153.      binding is found its command is returned, otherwise `nil' is
  154.      returned.
  155.  
  156.      If the optional RESET-PATH argument is non-`nil' the
  157.      `next-keymap-path' variable will be set to `nil', otherwise it
  158.      will be left with its original value.
  159.  
  160.  - Variable: keymap-path
  161.      A buffer-local variable providing the list of keymaps (or
  162.      variables whose values are keymaps) which will be searched for a
  163.      binding when the value of the `next-keymap-path' variable is `nil'.
  164.  
  165.           keymap-path
  166.               => (minor-mode-keymap texinfo-keymap global-keymap)
  167.  
  168.  - Variable: next-keymap-path
  169.      This variable is used to create multi-event key bindings. When it
  170.      has a non-`nil' value it overrides the `keymap-path' variable when
  171.      a key binding is being searched for.
  172.  
  173.      After the value of this variable is used to search for a key
  174.      binding it is set to `nil'. This means that, unless another prefix
  175.      key occurred, the next input event received will be resolved
  176.      through the `keymap-path' variable.
  177.  
  178.      When this variable is set the value of the `prefix-arg' variable is
  179.      set to the current value of the `current-prefix-arg' variable.
  180.      This is so a prefix argument given to a multi-event command is
  181.      transmitted through to the command.
  182.  
  183.      For more details on multi-event bindings see *Note Prefix Keys::.
  184.  
  185. 
  186. File: jade.info,  Node: Prefix Keys,  Next: Standard Keymaps,  Prev: Key Lookup,  Up: Keymaps
  187.  
  188. Prefix Keys
  189. -----------
  190.  
  191.    As briefly noted in the previous section it is possible to create
  192. multi-event key bindings. The `next-keymap-path' variable is used to
  193. link key presses (known as "prefix keys" since they prefix the actual,
  194. command-invoking, binding) to a new keymap environment which will be
  195. used to resolve the next key press. This method allows key sequences of
  196. an arbitrary length to be used.
  197.  
  198.    The best way to explain this is probably with an example. Consider
  199. the following,
  200.  
  201.      (setq entry-keymap (make-keylist))
  202.      (bind-keys entry-keymap
  203.       "Ctrl-x" '(setq next-keymap-path '(second-keymap)))
  204.      
  205.      (setq second-keymap (make-keylist))
  206.      (bind-keys second-keymap
  207.       "Ctrl-j" 'some-command)
  208.  
  209. Two keymaps are created, the first of which, `entry-keymap', would be
  210. placed in the `keymap-path' list. When `Ctrl-x' is typed the associated
  211. command would be invoked, installing the next piece of the chain, the
  212. `second-keymap' into the `next-keymap-path' variable.
  213.  
  214.    So, after `Ctrl-x' is typed the keymap environment will be the list
  215. of keymaps `(second-keymap)', subsequently typing `Ctrl-j' would then
  216. invoke the command `some-command'.
  217.  
  218. 
  219. File: jade.info,  Node: Standard Keymaps,  Prev: Prefix Keys,  Up: Keymaps
  220.  
  221. Standard Keymaps
  222. ----------------
  223.  
  224.    Several keymaps are predefined by Jade.
  225.  
  226. `global-keymap'
  227.      This keymap is the root of the global keymap structure; all buffers
  228.      which allow themselves to be edited have this keymap in their
  229.      `keymap-path'.
  230.  
  231. `ctrl-x-keymap'
  232.      This is linked to the `global-keymap' via the key `Ctrl-x'.
  233.  
  234. `ctrl-x-4-keymap'
  235.      The keymap for the global prefix `Ctrl-x 4'.
  236.  
  237. `ctrl-x-5-keymap'
  238.      The keymap for the global prefix `Ctrl-x 5'.
  239.  
  240. `user-keymap'
  241.      This keymap is only to be bound by the *user*, not by programmers!
  242.      It's linked to the global prefix `Ctrl-c' and is intended to allow
  243.      users to bind unmodified keys (modified keys with the prefix
  244.      `Ctrl-c' are usually bound to by modes) to commands which don't
  245.      have bindings by default.
  246.  
  247. 
  248. File: jade.info,  Node: Event Loop,  Next: Editing Files,  Prev: Keymaps,  Up: Programming Jade
  249.  
  250. Event Loop
  251. ==========
  252.  
  253.    Whenever Jade is not executing a command it is sitting in the "event
  254. loop". This is where the editor waits for any input events which the
  255. window system sends it, invokes the commands they resolve to and then
  256. redraws all the editor windows to reflect the modifications made to any
  257. buffers.
  258.  
  259. * Menu:
  260.  
  261. * Event Loop Actions::          What actually happens
  262. * Commands::                    Commands are Lisp functions which may
  263.                                   be called interactively by the user
  264. * Event Loop Info::             Information about the event loop
  265. * Recursive Edits::             How to call the event loop from Lisp
  266.                                   programs
  267. * Reading Events::              Reading single events in Lisp
  268. * Idle Actions::                What happens when nothing happens
  269.  
  270. 
  271. File: jade.info,  Node: Event Loop Actions,  Next: Commands,  Up: Event Loop
  272.  
  273. Event Loop Actions
  274. ------------------
  275.  
  276.    When Jade appears to be doing nothing it is probably sitting in the
  277. event loop waiting for input to arrive. When an input event arrives from
  278. the window system it is processed according to its type.
  279.  
  280.    If the input event is a keyboard or mouse button event it is
  281. converted into a Lisp input event (*note Input Events::.) and the
  282. current keymap environment is searched for a binding of that event
  283. (*note Key Lookup::.).  If a binding of the event is found it defines a
  284. command (*note Commands::.) to be invoked, the `call-command' function
  285. (*note Calling Commands::.) is used to do this.
  286.  
  287.    When no binding of a key or mouse button event exists the hook,
  288. `unbound-key-hook', is evaluated; if this returns `nil' and the event
  289. is a keyboard event and no prefix keys (*note Prefix Keys::.) preceded
  290. it the key is inserted into the current buffer before the cursor.
  291.  
  292.    If the event was not a keyboard or mouse button event the event loop
  293. will deal with it itself; these events are generally things which
  294. should be transparent to Lisp programs (i.e. window exposure
  295. notification, etc...).
  296.  
  297.    One exception is the event sent when a window should be closed (i.e.
  298. hitting the close-window gadget in Intuition, or sending a window the
  299. delete-window atom in X), the hook `window-closed-hook' is called. By
  300. default this hook is setup to invoke the `close-window' command (as
  301. bound to `Ctrl-x 0').
  302.  
  303.    Another function of the event loop is to wait for input from any of
  304. the subprocesses currently executing (*note Processes::.); whenever
  305. input is pending in a subprocess's standard output channel it is copied
  306. to the process objects's output stream.
  307.  
  308.    After processing an event or piece of subprocess output the event
  309. loop will redisplay any part of any window which needs to be updated;
  310. this may be necessary if a window is now displaying a different part of
  311. a buffer, or if the part of the buffer it is displaying has been
  312. modified.  *Note Rendering::.
  313.  
  314.    Normally Jade will `sleep' while it's waiting for input, however
  315. after every second it spends asleep the event loop will wake up and try
  316. to do a sequence of operations; for more details see *Note Idle
  317. Actions::.
  318.  
  319.  - Hook: unbound-key-hook
  320.      The hook called when an unbound input event is received.
  321.  
  322.  - Hook: window-closed-hook
  323.      The hook called when an event is received telling Jade to close a
  324.      window; the current window is the one which should be closed.
  325.  
  326. 
  327. File: jade.info,  Node: Commands,  Next: Event Loop Info,  Prev: Event Loop Actions,  Up: Event Loop
  328.  
  329. Commands
  330. --------
  331.  
  332.    A "command" is a Lisp function which may be called interactively,
  333. that is, either as a binding of an input event or by name (with the
  334. `Meta-x' key sequence).
  335.  
  336.    Commands are defined in the same way as functions, using the `defun'
  337. special form; the body forms of a command must contain an "interactive
  338. declaration". This shows that the function may be called interactively
  339. part and tells the `call-command' function how to compute the argument
  340. values to apply to the command.
  341.  
  342. * Menu:
  343.  
  344. * Interactive Declarations::    How to define a command
  345. * Prefix Arguments::            Arguments to a command from the user
  346. * Calling Commands::            The function used to invoke a command
  347. * Example Commands::            A definition of a command
  348.  
  349. 
  350. File: jade.info,  Node: Interactive Declarations,  Next: Prefix Arguments,  Up: Commands
  351.  
  352. Interactive Declarations
  353. ........................
  354.  
  355.    When you define a command (using the `defun' special form in the
  356. same way you would define a function) the first of its body forms (after
  357. the optional documentation string) *must* be an interactive declaration.
  358.  
  359.    This form looks like a call to the special form `interactive', in
  360. actual fact this special form always returns `nil' and has no
  361. side-effects. The only effect of this form is to show the
  362. `call-command' function, which invokes commands, that this function
  363. definition is actually a command (i.e.  it may be called
  364. interactively). The second element of the declaration form (after the
  365. `interactive' symbol) defines how the argument values applied to the
  366. command are computed.
  367.  
  368.    The structure of an interactive declaration, then, is:
  369.  
  370.      (interactive [CALLING-SPEC])
  371.  
  372.    When a command is defined this is how it is defined with the
  373. interactive declaration:
  374.  
  375.      (defun some-command (arg1)
  376.        "Optional documentation string."
  377.        (interactive ...)
  378.        ...
  379.  
  380.    The CALLING-SPEC form defines the argument values applied to the
  381. command when it is called interactively, it may be one of,
  382.  
  383.    * `nil' or undefined (i.e. `(interactive)'); no arguments are given
  384.      to the command, this type of interactive declaration just shows
  385.      that the function may be called interactively.
  386.  
  387.    * A string; zero or more lines (each separated by a newline
  388.      character), each line defines how to compute one argument value.
  389.      The first character of each line is a code letter defining exactly
  390.      how to compute the argument, the rest of the line is an optional
  391.      prompt string which some code letters show the user when prompting
  392.      for the argument.
  393.  
  394.      The currently available code letters are,
  395.  
  396.     `a'
  397.           Prompt, with completion, for a function object.
  398.  
  399.     `b'
  400.           Prompt, with completion, for an existing buffer object.
  401.  
  402.     `B'
  403.           Prompt, with completion, for a buffer; if it doesn't yet
  404.           exist it will be created.
  405.  
  406.     `c'
  407.           Prompt for a character.
  408.  
  409.     `C'
  410.           Prompt with completion for a command.
  411.  
  412.     `d'
  413.           The position of the cursor in the current window.
  414.  
  415.     `D'
  416.           Prompt with completion for the name of a directory in the
  417.           filing system.
  418.  
  419.     `e'
  420.           The event which caused this command to be invoked.
  421.  
  422.     `E'
  423.           The event which caused this command, cooked into a string.
  424.  
  425.     `f'
  426.           Prompt with completion for the name of an existing file.
  427.  
  428.     `F'
  429.           Prompt with completion for the name of a file; it doesn't
  430.           have to exist.
  431.  
  432.     `k'
  433.           Prompt for a single event.
  434.  
  435.     `m'
  436.           The starting position of the marked block in the current
  437.           window.
  438.  
  439.     `M'
  440.           The ending position of the current block.
  441.  
  442.     `n'
  443.           Prompt for a number.
  444.  
  445.     `N'
  446.           The prefix argument (*note Prefix Arguments::.) as a number,
  447.           if no prefix argument exists, prompt for a number.
  448.  
  449.     `p'
  450.           The prefix argument as a number, this will be 1 if no prefix
  451.           argument has been entered.
  452.  
  453.     `P'
  454.           The raw prefix argument.
  455.  
  456.     `s'
  457.           Prompt for a string.
  458.  
  459.     `S'
  460.           Prompt with completion for a symbol.
  461.  
  462.     `t'
  463.           The symbol `t'.
  464.  
  465.     `v'
  466.           Prompt with completion for a variable.
  467.  
  468.     `x'
  469.           Read one Lisp object.
  470.  
  471.     `X'
  472.           Read a Lisp object, then evaluate it.
  473.  
  474.      A null line produces an argument value of `nil'.
  475.  
  476.      Any non-alphabetic characters at the beginning of the CALLING-SPEC
  477.      are used as flags, the currently recognised flags are,
  478.  
  479.     `*'
  480.           If the active buffer is read-only an error will be signalled.
  481.  
  482.     `-'
  483.           After building the argument list the block marked in the
  484.           current window will be unmarked.
  485.  
  486.    * Anything else; the form is evaluated and expected to return a
  487.      *list* of arguments to apply to the command.
  488.  
  489.    Some example interactive declarations,
  490.  
  491.      ;; No arguments, but the function may be called
  492.      ;; as a command.
  493.      (interactive)
  494.      
  495.      ;; One argument, an existing buffer
  496.      (interactive "bBuffer to kill:")
  497.      
  498.      ;; If buffer isn't read-only, three arguments:
  499.      ;; `nil', a Lisp object and `t'.
  500.      (interactive "*\nxLisp form:\nt")
  501.  
  502. 
  503. File: jade.info,  Node: Prefix Arguments,  Next: Calling Commands,  Prev: Interactive Declarations,  Up: Commands
  504.  
  505. Prefix Arguments
  506. ................
  507.  
  508.    When the you invoke a command it is often useful to be able to
  509. specify arguments which the command will act on. "Prefix arguments" are
  510. used for this purpose. They are called *prefix* arguments since they
  511. are entered before the command is invoked, and therefore prefix the
  512. command with an argument. Prefix arguments are usually integers.
  513.  
  514.    The easiest way for a command to access these arguments is through
  515. its interactive declaration (*note Interactive Declarations::.) and the
  516. `N', `p' and `P' code letters.
  517.  
  518.    The two variables `prefix-arg' and `current-prefix-arg' are used to
  519. store prefix arguments. Whenever a command is invoked the value of
  520. `prefix-arg' is moved to `current-prefix-arg' and `prefix-arg' set to
  521. `nil'. This allows commands to set the prefix argument of the next
  522. command by assigning a value to the `prefix-arg' variable.
  523.  
  524.    These variables store an object known as the "raw prefix argument",
  525. when a command is called it normally uses the "numeric prefix argument",
  526. this is an integer created from the raw argument using the following
  527. rules,
  528.  
  529.    * If the raw arg is `nil' the numeric value is 1.
  530.  
  531.    * If the raw arg is any other symbol the value is -1.
  532.  
  533.    * A number is used unchanged.
  534.  
  535.    * A cons cell stores the numeric value in its car.
  536.  
  537.    The `prefix-numeric-argument' function is used to convert the raw
  538. argument into a numeric value.
  539.  
  540.  - Function: prefix-numeric-argument RAW-ARG
  541.      Returns the numeric value of the raw prefix argument RAW-ARG.
  542.  
  543.  - Variable: prefix-arg
  544.      The value of the raw prefix argument used by the next command to be
  545.      invoked.
  546.  
  547.  - Variable: current-prefix-arg
  548.      The value of the raw prefix argument of the current command.
  549.  
  550. 
  551. File: jade.info,  Node: Calling Commands,  Next: Example Commands,  Prev: Prefix Arguments,  Up: Commands
  552.  
  553. Calling Commands
  554. ................
  555.  
  556.    When a command is to be invoked, the `call-command' function is
  557. used. This builds a list of argument values to apply to the command
  558. (using its interactive declaration) then calls the command.
  559.  
  560.  - Function: commandp OBJECT
  561.      This function returns `t' if its argument may be called
  562.      interactively.  If OBJECT is a function (i.e. a symbol or a
  563.      lambda-expression) it is a command if it contains an interactive
  564.      declaration (*note Interactive Declarations::.).
  565.  
  566.      The only other object which is a command is a function call form;
  567.      the use of these types of commands is discouraged but they can be
  568.      useful sometimes.
  569.  
  570.           (commandp 'setq)
  571.               => nil
  572.           
  573.           (commandp 'isearch-forward)
  574.               => t
  575.           
  576.           (commandp '(setq x 20))
  577.               => t
  578.  
  579.  - Command: call-command COMMAND &optional PREFIX-ARG
  580.      This function calls the command COMMAND interactively. See the
  581.      documentation of `commandp' above for what constitutes a command.
  582.  
  583.      If the PREFIX-ARGUMENT is non-nil it defines the value of the
  584.      `current-prefix-arg' variable for this command, normally the value
  585.      of this variable would be taken from the global `prefix-arg'
  586.      variable.
  587.  
  588.      When called interactively, this function will prompt for a command
  589.      to invoke. This function is bound to the key sequence `Meta-x'.
  590.  
  591. 
  592. File: jade.info,  Node: Example Commands,  Prev: Calling Commands,  Up: Commands
  593.  
  594. Example Commands
  595. ................
  596.  
  597.    This is a couple of simple commands, taken from the source code of
  598. Jade.
  599.  
  600.      (defun backward-kill-word (count)
  601.        "Kill COUNT words backwards."
  602.        (interactive "p")
  603.        (kill-area (forward-word (- count)) (cursor-pos)))
  604.  
  605.      (defun find-file (name)
  606.        "Sets the current buffer to that containing the file NAME, if
  607.      NAME is unspecified it will be prompted for. If the file is not
  608.      already in memory `open-file' will be used to load it."
  609.        (interactive "FFind file: ")
  610.        (goto-buffer (open-file name)))
  611.  
  612. 
  613. File: jade.info,  Node: Event Loop Info,  Next: Recursive Edits,  Prev: Commands,  Up: Event Loop
  614.  
  615. Event Loop Information
  616. ----------------------
  617.  
  618.  - Variable: this-command
  619.      This variable contains the value of the command currently being
  620.      executed.
  621.  
  622.  - Variable: last-command
  623.      Holds the previously executed command.
  624.  
  625.  - Function: current-event
  626.      Returns the event which caused this command to be invoked.
  627.  
  628.  - Function: current-event-string
  629.      Returns a string which is the `cooked' representation of the
  630.      current event.
  631.  
  632.  - Function: last-event
  633.      Returns the event which caused the previous command.
  634.  
  635. 
  636. File: jade.info,  Node: Recursive Edits,  Next: Reading Events,  Prev: Event Loop Info,  Up: Event Loop
  637.  
  638. Recursive Edits
  639. ---------------
  640.  
  641.    Entering a "recursive edit" basically means to recursively call the
  642. event loop from a Lisp program, this latest instance of the event loop
  643. will work like the normal event loop (the "top level" event loop) until
  644. it is exited, at which point the Lisp program will regain control.
  645.  
  646.    Recursive edits should be used sparingly since they can be very
  647. confusing for the user; they are mainly used to implement interactive
  648. user interfaces in the middle of a Lisp program or command. This can be
  649. achieved by installing a special set of key bindings for the duration
  650. of the recursive edit.
  651.  
  652.    When programming with recursive edits *a lot* of care should be
  653. used; if proper cautions aren't taken an abnormal exit from a recursive
  654. error can wreak havoc.
  655.  
  656.    Note that `throw' and `catch' (*note Catch and Throw::.) can be used
  657. *through* recursive edits with no problems; the recursive edit will
  658. automatically be aborted.
  659.  
  660.  - Command: recursive-edit
  661.      Enter a new level of recursive editing.
  662.  
  663.  - Function: recursion-depth
  664.      This function returns the number of recursive edits currently in
  665.      progress. When in the top level this will return zero.
  666.  
  667.  - Command: top-level
  668.      Abort all recursive edits, control will be passed straight back to
  669.      the top level event loop.
  670.  
  671.  - Command: abort-recursive-edit &optional EDIT-VALUE
  672.      This function aborts the outermost recursive edit (but *never* the
  673.      top level) returning EDIT-VALUE (or `nil') from the instance of
  674.      the `recursive-edit' function which invoked this recursive edit.
  675.  
  676.    When using recursive edits it is important to remember that the
  677. buffer and window configuration that existed when the edit was entered
  678. may not still exist when the recursive edit terminates. This means that
  679. some care has to be taken when installing and removing buffer-local
  680. values of variables. For example, the `ask-y-or-n' function, which uses
  681. a recursive edit, does something like this:
  682.  
  683.      (let
  684.          ;; First save the old values of the variables to be altered.
  685.          ;; The variables can't be directly bound to since this doesn't
  686.          ;; work properly with buffer-local variables :-(
  687.          ((old-u-k-h unbound-key-hook)
  688.           (old-k-p keymap-path)
  689.           (old-buf (current-buffer)))
  690.        ;; Now install the new values
  691.        (setq unbound-key-hook (cons #'(lambda ()
  692.                                         (beep)
  693.                                         t)
  694.                                     nil)
  695.              keymap-path '(y-or-n-keymap)
  696.              status-line-cursor t)
  697.        ;; This is the important bit; ensure that the old values will
  698.        ;; be reinstated even if an abnormal exit occurs. Also note
  699.        ;; that they are always set in the original buffer.
  700.        (unwind-protect
  701.            (catch 'ask
  702.              (recursive-edit))
  703.          (with-buffer old-buf
  704.            (setq keymap-path old-k-p
  705.                  unbound-key-hook old-u-k-h
  706.                  status-line-cursor nil)))))
  707.  
  708. 
  709. File: jade.info,  Node: Reading Events,  Next: Idle Actions,  Prev: Recursive Edits,  Up: Event Loop
  710.  
  711. Reading Events
  712. --------------
  713.  
  714.    Most of the time it is unnecessary to read events manually; usually
  715. a special-purpose keymap will be sufficient. However it is possible to
  716. read single events from a Lisp program.
  717.  
  718.  - Function: read-event &optional PROMPT-STRING
  719.      Read the next input event from the current window and return it.
  720.      If the optional string PROMPT-STRING is defined it is a one-line
  721.      message to display while waiting for the event.
  722.  
  723.      Note that this function isn't very efficient when used heavily; it
  724.      uses a recursive edit and the `unbound-key-hook' to read the
  725.      event. If possible use a keymap instead.
  726.  
  727. 
  728. File: jade.info,  Node: Idle Actions,  Prev: Reading Events,  Up: Event Loop
  729.  
  730. Idle Actions
  731. ------------
  732.  
  733.    When a second goes by with no input events arriving, the editor
  734. assumes that is has "idle time" available, and tries to use this period
  735. to do non-essential tasks. These tasks include things like garbage
  736. collection and auto-saving modified files.
  737.  
  738.    Whenever idle time is detected one of the following tasks is
  739. performed. They are listed in order of preference; once one of these
  740. has been done Jade will again sleep until an input event is received or
  741. another second elapses, whichever happens soonest.
  742.  
  743.   1. If prefix keys have been entered and are outstanding their names
  744.      will be printed in the status line. *Note Prefix Keys::.
  745.  
  746.   2. If any buffers are ready to be auto-saved (i.e. enough time since
  747.      their last auto-save has elapsed) one of these buffers will be
  748.      auto-saved.  Only one buffer is ever saved in each idle period.
  749.      *Note Auto-Saving Files::.
  750.  
  751.   3. If the total size of the data objects allocated since the last
  752.      garbage collection is greater than the value of the
  753.      `idle-gc-threshold' variable then the garbage collector is invoked.
  754.  
  755.       - Variable: idle-garbage-threshold
  756.           The number of bytes of Lisp data which must have been
  757.           allocated since the last garbage collection for the garbage
  758.           collector to be called in an idle period.
  759.  
  760.           It is a good idea to set this variable much lower than the
  761.           value of the `gc-threshold' variable since garbage
  762.           collections happening while Jade is idle should usually be
  763.           unnoticeable.
  764.  
  765.      *Note Garbage Collection::.
  766.  
  767.   4. If none of the other tasks have been performed the `idle-hook' hook
  768.      is dispatched. I'm not sure what this hook could be used for but
  769.      you never know...
  770.  
  771. 
  772. File: jade.info,  Node: Editing Files,  Next: Text,  Prev: Event Loop,  Up: Programming Jade
  773.  
  774. Editing Files
  775. =============
  776.  
  777.    The main function of Jade is editing files of text; buffers (*note
  778. Buffers::.) are used to contain files to be edited. When the buffer is
  779. displayed in a window (*note Windows::.) the user can edit the file
  780. interactively using the keyboard and mouse.
  781.  
  782.    This chapter documents the Lisp interface to all this; for the user's
  783. perspective see *Note Loading and Saving Files::.
  784.  
  785. * Menu:
  786.  
  787. * Reading Files Into Buffers::  How to read a file into a buffer
  788. * Writing Buffers::             Functions to write buffers to files
  789. * Buffer Date Stamps::          The last-modification time of each
  790.                                   file is recorded
  791. * Buffer Modification Counts::  Variables storing modification counts
  792. * Making Backups::              How backup files can be made
  793. * Controlling Auto-Saves::      Functions to control the auto-saving
  794.                                   feature
  795.  
  796. 
  797. File: jade.info,  Node: Reading Files Into Buffers,  Next: Writing Buffers,  Up: Editing Files
  798.  
  799. Reading Files Info Buffers
  800. --------------------------
  801.  
  802.    Before a file can be edited it must be read into a buffer, this
  803. buffer can then be modified and later saved over the original contents
  804. of the file. Note that editing a buffer makes *no* changes to the
  805. contents of the file on disk; the buffer will have to be written back
  806. to the file on the disk first. *Note Writing Buffers::.
  807.  
  808.  - Function: open-file FILE-NAME
  809.      This function returns a buffer containing the contents of the file
  810.      called FILE-NAME.
  811.  
  812.      If an existing buffer contains the file called FILE-NAME that
  813.      buffer is returned. Otherwise a new buffer is created and the file
  814.      read into it.
  815.  
  816.      When the file has successfully been read into the new buffer any
  817.      local variables defined at the end of the file are processed
  818.      (*note File Variables::.) and the function `init-mode' is used to
  819.      try to install a major mode for the new buffer. *Note Installing
  820.      Modes::.
  821.  
  822.      If file may not be written to the buffer is marked to be read-only.
  823.  
  824.      Note that the hook, `read-file-hook', can be used to read the
  825.      contents of the file into the buffer if necessary. See the
  826.      documentation of this hook for more details.
  827.  
  828.  - Hook: read-file-hook
  829.      This hook is called by the `open-file' function when it wants to
  830.      read a file into a buffer. If the hook returns a non-`nil' value
  831.      `open-file' assumes that one member of the hook was successful in
  832.      reading the file, otherwise the file will be read verbatim into the
  833.      buffer.
  834.  
  835.      The hook is called with two arguments: the name of the file and the
  836.      buffer to read it into respectively.
  837.  
  838.      If any members of the hook decide to read the file they're
  839.      responsible for setting the `buffer-file-name' component of the
  840.      buffer and the buffer's `buffer-file-modtime' variables to
  841.      suitable values.
  842.  
  843.      See the `gzip.jl' file in the Lisp library directory for an example
  844.      of how this hook can be used (in this case to automatically
  845.      decompress gzip'ed files).
  846.  
  847.  - Function: read-buffer FILE-OR-NAME &optional BUFFER
  848.      Replaces all text contained by the buffer by the contents of the
  849.      file FILE-OR-NAME. This can be either a Lisp file object, in which
  850.      case bytes will be read until the end of the file is reached, or
  851.      the name of a file to read.
  852.  
  853.    The following commands are used to read a file into a buffer then
  854. display that buffer in the current buffer.
  855.  
  856.  - Command: find-file FILE-NAME
  857.      Display a buffer containing the file FILE-NAME in the current
  858.      window.
  859.  
  860.      When called interactively FILE-NAME will be prompted for.
  861.  
  862.  - Command: find-alternate-file FILE-NAME
  863.      Replace the current buffer with one displaying the file FILE-NAME.
  864.      What actually happens is that the current buffer is killed and a
  865.      new one created.
  866.  
  867.      When called interactively this function will prompt for its
  868.      argument.
  869.  
  870.  - Command: find-file-read-only FILE-NAME
  871.      Display a buffer containing FILE-NAME in the current window. The
  872.      buffer will be read-only.
  873.  
  874.      This will prompt for its argument when called interactively.
  875.  
  876.    There is also a command to insert the contents of a file into a
  877. buffer.
  878.  
  879.  - Command: insert-file FILE-NAME &optional BUFFER
  880.      This command inserts the contents of the file FILE-NAME into the
  881.      buffer BUFFER (or the current buffer).
  882.  
  883.      The hook `insert-file-hook' is called with FILE-NAME as an
  884.      argument to try and insert the file (into the current buffer at the
  885.      current position). If this hook returns `nil' (i.e. none of the
  886.      functions in the hook inserted the file) it will be inserted
  887.      normally.
  888.  
  889.      If called interactively, FILE-NAME will be prompted for.
  890.  
  891.  - Hook: insert-file-hook
  892.      Hook used to insert a file (given as the hook's argument) into the
  893.      current buffer at the current cursor position.
  894.  
  895.  - Command: revert-buffer &optional BUFFER
  896.      Reloads the contents of the buffer from the file it was originally
  897.      loaded from; if any unsaved modifications will be lost the user is
  898.      asked for confirmation.
  899.  
  900. 
  901. File: jade.info,  Node: Writing Buffers,  Next: Buffer Date Stamps,  Prev: Reading Files Into Buffers,  Up: Editing Files
  902.  
  903. Writing Buffers
  904. ---------------
  905.  
  906.    After a buffer containing a file has been edited it must be written
  907. back to a file on disk, otherwise the modifications will disappear when
  908. Jade is exited!
  909.  
  910.  - Function: write-buffer &optional FILE-NAME BUFFER
  911.      The primitive to save a buffer's contents. The contents of the
  912.      buffer BUFFER (or the current buffer) is written to the file
  913.      FILE-NAME (or the `buffer-file-name' component of the buffer).
  914.  
  915.  - Function: write-buffer-area START-POS END-POS FILE-NAME &optional
  916.           BUFFER
  917.      Writes the region of text from START-POS up to, but not including,
  918.      END-POS to the file FILE-NAME.
  919.  
  920.  - Function: write-file BUFFER &optional FILE-NAME
  921.      Writes the contents of the buffer BUFFER to a file on disk. If the
  922.      optional argument FILE-NAME is defined it names the file to write
  923.      to. Otherwise, the value of the buffer's `buffer-file-name'
  924.      component is used.
  925.  
  926.      The hook `write-file-hook' is used to try and write the file, if
  927.      this fails (i.e. the hook returns `nil') the buffer is saved
  928.      normally.
  929.  
  930.      A backup may be made of the file to be overwritten (*note Making
  931.      Backups::.) and the protection-modes of the overwritten file will
  932.      be preserved if possible.
  933.  
  934.  - Hook: write-file-hook
  935.      This hook is called by the `write-file' function when a buffer is
  936.      to be saved. If no member of the hook actually writes the buffer
  937.      to a file (i.e. the hook returns `nil') `write-file' will do it
  938.      itself in a standard way.
  939.  
  940.      The hook function is responsible for creating any required backup
  941.      file (use the function `backup-file', *note Making Backups::.) and
  942.      resetting the protection-modes of the new file to their original
  943.      value.
  944.  
  945.      See the file `gzip.jl' in the Lisp library directory for an
  946.      example, it uses it to compress certain files automatically.
  947.  
  948.      Remember to make sure that if a member of the hook writes the
  949.      buffer it returns a non-`nil' value!
  950.  
  951.      The following code fragment defines a function which does what the
  952.      default action of `write-file' is,
  953.  
  954.           (defun write-file-default-action (buffer name)
  955.             (let
  956.                 ((modes (when (file-exists-p name) (file-modes name))))
  957.               (backup-file name)
  958.               (when (write-buffer name buffer)
  959.                 (when modes
  960.                   (set-file-modes name modes))
  961.                  t)))
  962.  
  963.    The following commands call the `write-file' function to write out a
  964. buffer, they also update the various variables containing information
  965. about the state of the buffer. It is normally unnecessary to call
  966. `write-file' yourself; these commands should suffice.
  967.  
  968.  - Command: save-file &optional BUFFER
  969.      This command writes the buffer to the file that it was loaded from
  970.      and then updates all the necessary buffer-local variables.
  971.  
  972.      If the file on disk has been modified since it was read into the
  973.      buffer the user is asked if they really want to save it (and risk
  974.      losing a version of the file).
  975.  
  976.      If no modifications have been made to the file since it was last
  977.      saved it won't be saved again.
  978.  
  979.      Any auto-saved version of the file is deleted.
  980.  
  981.  - Command: save-file-as NEW-NAME &optional BUFFER
  982.      This command saves the buffer BUFFER (or the current buffer) to
  983.      the file called NEW-NAME. The `buffer-file-name' is set to
  984.      NEW-NAME and all the necessary buffer-local variables are updated.
  985.  
  986.      If an auto-saved version of FILE-NAME exists it is deleted.
  987.  
  988.      When called interactively NEW-NAME will be prompted for.
  989.  
  990.  - Command: save-some-buffers
  991.      For each buffer which contains unsaved modifications the user is
  992.      asked whether or not to save the buffer.
  993.  
  994.      `t' is returned if no unsaved modifications exist in any buffers
  995.      (i.e. the user replied `yes' to all files which could be saved).
  996.  
  997.  - Command: save-and-quit
  998.      Calls `save-some-buffers' then quits Jade (after asking the user
  999.      if any unsaved buffers may be discarded).
  1000.  
  1001. 
  1002. File: jade.info,  Node: Buffer Date Stamps,  Next: Buffer Modification Counts,  Prev: Writing Buffers,  Up: Editing Files
  1003.  
  1004. Buffer Date Stamps
  1005. ------------------
  1006.  
  1007.    When a file is read into a buffer its (the file's) time of last
  1008. modification is recorded, this can later be used to see if the file (on
  1009. disk) has been modified since it was loaded into a buffer.
  1010.  
  1011.  - Variable: buffer-file-modtime
  1012.      This buffer-local variable contains the file-modtime of the file
  1013.      stored in the buffer when it (the file) was last read from disk.
  1014.  
  1015.    *Note File Information::.
  1016.  
  1017. 
  1018. File: jade.info,  Node: Buffer Modification Counts,  Next: Making Backups,  Prev: Buffer Date Stamps,  Up: Editing Files
  1019.  
  1020. Buffer Modification Counts
  1021. --------------------------
  1022.  
  1023.    Two buffer-local variables are used to record the modification count
  1024. (*note Buffer Attributes::.) of a buffer when it is saved.
  1025.  
  1026.  - Variable: last-save-changes
  1027.      A buffer-local variable containing the number of modifications
  1028.      made to the buffer the last time it was saved (either auto-saved
  1029.      or by the user).
  1030.  
  1031.  - Variable: last-user-save-changes
  1032.      This buffer-local variable holds the number of modifications made
  1033.      to the buffer when it was last saved by the user.
  1034.  
  1035.  - Variable: last-save-time
  1036.      A buffer-local variable holding the system time (from the
  1037.      `current-time' function) from when the buffer was last saved
  1038.      (auto-saved or by the user).
  1039.  
  1040. 
  1041. File: jade.info,  Node: Making Backups,  Next: Controlling Auto-Saves,  Prev: Buffer Modification Counts,  Up: Editing Files
  1042.  
  1043. Making Backups
  1044. --------------
  1045.  
  1046.    For details of the variables which control whether and how backup
  1047. files are made see *Note Backup Files::.
  1048.  
  1049.  - Function: backup-file FILE-NAME
  1050.      When necessary, make a backup of the file FILE-NAME. This should be
  1051.      called when the file FILE-NAME is about to be overwritten.
  1052.  
  1053.      Note that this function doesn't define whether or not the file
  1054.      FILE-NAME will still exist when this function returns. Sometimes
  1055.      it will, sometimes it won't...
  1056.  
  1057. 
  1058. File: jade.info,  Node: Controlling Auto-Saves,  Prev: Making Backups,  Up: Editing Files
  1059.  
  1060. Controlling Auto-Saves
  1061. ----------------------
  1062.  
  1063.    For the documentation of the variables controlling the making of
  1064. auto-save files see *Note Auto-Saving Files::.
  1065.  
  1066.  - Function: make-auto-save-name FILE-NAME
  1067.      Returns a string naming the file which should hold the auto-saved
  1068.      version of the file FILE-NAME.
  1069.  
  1070.           (make-auto-save-name "/tmp/foo")
  1071.               => "/tmp/#foo#"
  1072.  
  1073.  - Function: auto-save-function BUFFER
  1074.      This function is called automatically whenever a buffer (BUFFER)
  1075.      needs to be auto-saved.
  1076.  
  1077.      It firstly tries to use the `auto-save-hook' hook to auto-save the
  1078.      file, if this fails (i.e. the hook returns `nil') it is done
  1079.      manually (using the `write-buffer' function).
  1080.  
  1081.  - Hook: auto-save-hook
  1082.      Called by `auto-save-function' (with the buffer as an argument)
  1083.      when a buffer is to be auto-saved.
  1084.  
  1085.  - Command: delete-auto-save-file &optional BUFFER
  1086.      This command deletes the auto-saved version of the buffer, if one
  1087.      exists.
  1088.  
  1089.  - Function: auto-save-file-newer-p FILE-NAME
  1090.      This function returns `t' when there is an auto-saved version of
  1091.      the file called FILE-NAME which is newer than FILE-NAME.
  1092.  
  1093.  - Command: recover-file &optional BUFFER
  1094.      If an auto-saved version of the buffer exists it is read into the
  1095.      buffer, overwriting its current contents. If any changes to the
  1096.      buffer will be lost the user is asked for confirmation.
  1097.  
  1098. 
  1099. File: jade.info,  Node: Text,  Next: Writing Modes,  Prev: Editing Files,  Up: Programming Jade
  1100.  
  1101. Text
  1102. ====
  1103.  
  1104.    This chapter describes all the functions used for editing and
  1105. referencing the text stored in a buffer.
  1106.  
  1107.    Note that where a command has a COUNT argument specifying the number
  1108. of items to process; this argument will normally use the numeric value
  1109. of the prefix argument when the function is called interactively.
  1110.  
  1111. * Menu:
  1112.  
  1113. * Buffer Contents::             Accessing the contents of a buffer
  1114. * Insertion Functions::         Inserting strings into a buffer
  1115. * Deletion Functions::          Deleting regions of text
  1116. * Kill Functions::              Recording regions of text
  1117. * Transpose Functions::         Swapping two regions of text
  1118. * Indentation Functions::       Functions for managing indentation
  1119. * Translation Functions::       Applying a mapping to characters in a buffer
  1120. * Search and Match Functions::  Regexps and general string matching
  1121. * Rectangular Editing::         Manipulating rectangular regions
  1122. * Controlling Undo::            How undo works
  1123. * Misc Text Functions::         Other stuff
  1124.  
  1125. 
  1126. File: jade.info,  Node: Buffer Contents,  Next: Insertion Functions,  Up: Text
  1127.  
  1128. Buffer Contents
  1129. ---------------
  1130.  
  1131.  - Function: get-char &optional POS BUFFER
  1132.      Returns the character at position POS (or the cursor position) in
  1133.      the specified buffer.
  1134.  
  1135.  - Function: set-char CHARACTER &optional POS BUFFER
  1136.      Sets the character at position POS (or the cursor) in the buffer
  1137.      BUFFER (or the current buffer) to the character CHARACTER, then
  1138.      returns CHARACTER.
  1139.  
  1140.  - Function: copy-area START-POS END-POS &optional BUFFER
  1141.      This function creates and returns a string containing the contents
  1142.      of the buffer BUFFER (or the current buffer) between the two
  1143.      positions START-POS (inclusive) and END-POS (exclusive).
  1144.  
  1145.  - Function: copy-block
  1146.      If a block is marked in the current window returns a string
  1147.      containing the text marked then unmark the block, otherwise
  1148.      returns `nil'.
  1149.  
  1150.      If the marked block is rectangular the `copy-rect' function (*note
  1151.      Rectangular Editing::. is used to get the string.
  1152.  
  1153.  - Function: clear-buffer &optional BUFFER
  1154.      Removes all text from the specified buffer. No precautions are
  1155.      taken against losing any unsaved modifications that the buffer
  1156.      might contain!
  1157.  
  1158. 
  1159. File: jade.info,  Node: Insertion Functions,  Next: Deletion Functions,  Prev: Buffer Contents,  Up: Text
  1160.  
  1161. Insertion Functions
  1162. -------------------
  1163.  
  1164.    Note that the `format' function can be used to provide formatted
  1165. insertion; simply give it a suitable output stream.  *Note Streams::.
  1166.  
  1167.  - Command: insert STRING &optional POS BUFFER
  1168.      Inserts the string STRING into the specified buffer at the cursor
  1169.      position (or POS, if defined).
  1170.  
  1171.      Returns the position of the first character after the end of the
  1172.      inserted text.
  1173.  
  1174.      When called interactively the string to insert is prompted for.
  1175.  
  1176.  - Command: insert-block &optional POS
  1177.      If a block is marked in the current window, the text it contains is
  1178.      inserted at the position POS (or the cursor) and the block is
  1179.      unmarked.
  1180.  
  1181.      If the marked block is rectangular the block is copied and inserted
  1182.      as a rectangle.
  1183.  
  1184.  - Command: yank &optional DONT-YANK-BLOCK
  1185.      Inserts a string before the cursor. If a block is marked in the
  1186.      current buffer and DONT-YANK-BLOCK is `nil' insert the text in the
  1187.      block. Else yank the last killed text. *Note Kill Functions::.
  1188.  
  1189.      When called interactively the raw prefix arg is used as the value
  1190.      of the DONT-YANK-BLOCK argument.
  1191.  
  1192.  - Command: yank-to-mouse
  1193.      Moves the cursor to the current position of the mouse pointer then
  1194.      calls the `yank' function.
  1195.  
  1196.  - Command: open-line COUNT
  1197.      Break the current line at the cursor, creating COUNT new lines. The
  1198.      cursor is left in its original position.
  1199.  
  1200.  - Command: split-line
  1201.      This function inserts a newline character (`\n') at the current
  1202.      cursor position.
  1203.  
  1204. 
  1205. File: jade.info,  Node: Deletion Functions,  Next: Kill Functions,  Prev: Insertion Functions,  Up: Text
  1206.  
  1207. Deletion Functions
  1208. ------------------
  1209.  
  1210.  - Function: delete-area START-POS END-POS &optional BUFFER
  1211.      This function deletes all text starting from the position START-POS
  1212.      up to, but not including, the position END-POS.
  1213.  
  1214.      If BUFFER is defined it specifies the buffer to delete from,
  1215.      usually the current buffer is used.
  1216.  
  1217.  - Function: cut-area START-POS END-POS &optional BUFFER
  1218.      This function is a combination of the `copy-area' and `delete-area'
  1219.      functions; it copies the specified region then deletes it before
  1220.      returning the copy it made.
  1221.  
  1222.           (cut-area START END)
  1223.           ==
  1224.           (let
  1225.               ((text (copy-area START END)))
  1226.             (delete-area START END)
  1227.             text)
  1228.  
  1229.  - Command: delete-block
  1230.      Deletes the block marked in the current window (if one exists).
  1231.      This function knows about rectangular blocks.
  1232.  
  1233.  - Function: cut-block
  1234.      Copies the block marked in the current window if one exists, then
  1235.      deletes it before returning the copied string. If the block is
  1236.      rectangular it is copied and cut as a rectangle.
  1237.  
  1238.  - Command: delete-char COUNT
  1239.      Deletes COUNT characters, starting at the cursor position and
  1240.      working forwards.
  1241.  
  1242.  - Command: backspace-char COUNT
  1243.      Deletes the COUNT characters preceding the cursor, if the cursor
  1244.      is past the end of the line, simply move COUNT characters to the
  1245.      left.
  1246.  
  1247. 
  1248. File: jade.info,  Node: Kill Functions,  Next: Transpose Functions,  Prev: Deletion Functions,  Up: Text
  1249.  
  1250. Kill Functions
  1251. --------------
  1252.  
  1253.    "Killing" a piece of text means to delete it then store a copy of it
  1254. in a special place. This string is later available to other functions,
  1255. such as `yank' which inserts it into a buffer.
  1256.  
  1257.  - Function: kill-string STRING
  1258.      This function adds the string STRING to the kill buffer. If the
  1259.      last command also killed something STRING is appended to the
  1260.      current value of the kill buffer.
  1261.  
  1262.      The `this-command' variable is set to the value `kill' to flag
  1263.      that the current command did some killing.
  1264.  
  1265.      Returns STRING.
  1266.  
  1267.  - Function: killed-string &optional DEPTH
  1268.      Returns the string in the kill buffer number DEPTH, currently only
  1269.      the last kill is stored so DEPTH must either be zero or undefined.
  1270.  
  1271.  - Command: kill-area START-POS END-POS
  1272.      This command kills a region of text in the current buffer, from
  1273.      START-POS up to, but not including, END-POS.
  1274.  
  1275.      When called interactively the currently marked block (if one
  1276.      exists) is used to provide the two arguments, then the block is
  1277.      unmarked.
  1278.  
  1279.  - Command: copy-area-as-kill START-POS END-POS
  1280.      Similar to `kill-area' except that the region killed is not
  1281.      actually deleted from the buffer.
  1282.  
  1283.  - Command: kill-block
  1284.      Kills the block marked in the current window.
  1285.  
  1286.  - Command: copy-block-as-kill
  1287.      Kills the block marked in this window but doesn't actually delete
  1288.      it from the buffer.
  1289.  
  1290.  - Command: kill-line &optional ARG
  1291.      This command kills lines from the cursor position. ARG is a raw
  1292.      prefix argument (*note Prefix Arguments::.). What gets killed
  1293.      depends on ARG,
  1294.  
  1295.         * When ARG is `nil' it kills from the cursor position to the end
  1296.           of the line, if the cursor is already at the end of the line
  1297.           it kills the newline character.
  1298.  
  1299.         * If the numeric value of ARG is greater than zero it kills
  1300.           from the cursor for that many whole lines.
  1301.  
  1302.         * If the numeric value is less than or equal to zero it kills
  1303.           that number of whole lines *backwards* from the cursor.
  1304.  
  1305.  - Command: kill-whole-line COUNT
  1306.      Kills *all* of the COUNT (an integer) next following lines.
  1307.  
  1308.  - Command: kill-word COUNT
  1309.      Kills COUNT words, starting at the cursor position.
  1310.  
  1311.      When called interactively COUNT is the numeric prefix arg.
  1312.  
  1313.  - Command: backwards-kill-word COUNT
  1314.      Kills the COUNT previous words, starting from the cursor.
  1315.  
  1316.      When called interactively COUNT is the numeric prefix arg.
  1317.  
  1318.  - Command: kill-exp &optional COUNT
  1319.      Kill COUNT expressions from the cursor position.  *Note
  1320.      Mode-Specific Expressions::.
  1321.  
  1322.  - Command: backward-kill-exp &optional COUNT
  1323.      Kills COUNT expressions, working backwards from the cursor.  *Note
  1324.      Mode-Specific Expressions::.
  1325.  
  1326. 
  1327. File: jade.info,  Node: Transpose Functions,  Next: Indentation Functions,  Prev: Kill Functions,  Up: Text
  1328.  
  1329. Transpose Functions
  1330. -------------------
  1331.  
  1332.    "Transposing" two regions of text in a buffer means to swap their
  1333. positions.
  1334.  
  1335.  - Function: transpose-items FORWARD-ITEM-FUN BACKWARD-ITEM-FUN COUNT
  1336.      This function transposes the areas defined by the functions
  1337.      FORWARD-ITEM-FUN and BACKWARD-ITEM-FUN (these functions must work
  1338.      in the style of `forward-word' and `backward-word' respectively).
  1339.  
  1340.      What actually happens is that the item before the cursor is dragged
  1341.      forward over the next COUNT items.
  1342.  
  1343.  - Command: transpose-words COUNT
  1344.      Uses `transpose-items' with each item being a word.
  1345.  
  1346.      When called interactively, COUNT is the value of the numeric
  1347.      prefix argument.
  1348.  
  1349.  - Command: transpose-chars COUNT
  1350.      Transposes characters.
  1351.  
  1352.  - Command: transpose-exps COUNT
  1353.      If the major mode in the current buffer has installed functions
  1354.      which define expressions then this command transposes expressions.
  1355.      *Note Mode-Specific Expressions::.
  1356.  
  1357.